package pl.kosmowska.ewelina.server.locators;

import java.io.Serializable;

import javax.jdo.PersistenceManager;

import pl.kosmowska.ewelina.server.jdo.DatabaseEntity;
import pl.kosmowska.ewelina.server.jdo.UserData;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.web.bindery.requestfactory.shared.Locator;

public abstract class EntityLocator<I extends Serializable> extends Locator<DatabaseEntity<I>, I> {

  @Override
  public DatabaseEntity<I> create(Class<? extends DatabaseEntity<I>> clazz) {
    try {
      return clazz.newInstance();
    } catch (InstantiationException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }


  

	  

  @Override
  public Class<DatabaseEntity<I>> getDomainType() {
    return null;
  }

  @Override
  public I getId(DatabaseEntity<I> entity) {
    return entity.getId();
  }

  @Override
  public Object getVersion(DatabaseEntity<I> entity) {
    return entity.getVersion();
  }
  
}